<!DOCTYPE html>
<html>
    {include file="Widgets/head" /}
    <body class="gray-bg">
        <div class="wrapper wrapper-content animated fadeInUp">
            <div class="row">
                <div class="col-sm-12">
                    <div class="ibox">
                        <div class="ibox-title">
                            <h3>投资明细</h3>
                            <a class="pull-right" href="javascript:void(0);" onclick="window.history.back()">
                                <button class="btn btn-primary" type="button">返回</button>
                            </a>
                        </div>
                        <div class="ibox-content">
                            <table class="table table-bordered table-hover">
                                <thead>
                                    <tr>
                                        <th>序号</th>
                                        <th>投资人</th>
                                        <th>投资金额</th>
                                        <th>投资时间</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    {if ($list)}
                                        {foreach $list as $key => $val} 
                                            <tr class="gradeA odd">
                                                <td>{$key + 1}</td>
                                                <td>{$val['real_name']}</td>
                                                <td>{$val['money']}</td>
                                                <td>{$val['create_time']}</td>
                                            </tr>
                                        {/foreach}                            
                                    {else /}
                                        <tr class="gradeA odd">
                                            <td style="text-align:center;" colspan="4">没有找到符合条件的记录</td>
                                        </tr>
                                    {/if}
                                </tbody>
                            </table>
                            {//分页}
                            <div>
                                <div class="row">
                                    {$paginator}
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="modal fade sc-modal-sm" style="margin-top:10%;" tabindex="-1" role="dialog"
            aria-labelledby="mySmallModalLabel">
           <div class="modal-dialog modal-sm" style="width:500px;">
               <div class="modal-content">
                   <div class="modal-body">
                       <div class="modal-header">
                           <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
                                       aria-hidden="true">×</span></button>
                           <h4 class="modal-title" id="mySmallModalLabel">删除资产</h4>
                       </div>
                       <div class="modal-body">
                           <h3>确定要删除此资产吗？</h3>
                           <form id="delete-ads">
                               <input id="id" name="id" type="hidden" value="">
                           </form>
                       </div>
                       <div class="modal-footer">
                           <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                           <button type="button" class="btn btn-primary delete-ads">确定</button>
                       </div>
                   </div>
               </div>
           </div>
       </div>

        <script>
            $(function () {
                $('.sc-modal-sm').on('show.bs.modal', function (event) {
                    var button = $(event.relatedTarget);
                    var id = button.data('id');
                    var modal = $(this);
                    modal.find('.modal-body input#id').val(id);
                });
                $('.delete-ads').on('click', function () {
                    $.ajax({
                        type: 'POST',
                        url: "{:url('Assets/delete')}",
                        data: $('#delete-ads').serialize(),
                        dataType: 'json',
                        success: function (data) {
                            if (data.code == 1) {
                                window.location.href = window.location.href;
                            } else {
                                alert(data.msg)
                            }
                        },
                        error: function (xhr, type) {
                            alert('Ajax error!')
                        }
                    });
                });
            });
        </script>
    </body>
</html>
